<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
	function checkForm(){
		var recipients = document.getElementById("recipients");
		var subject = document.getElementById("subject");
		var content = document.getElementById("content");
		
		if(recipients.value == ""){
			alert("请选择收件人！");
			return false;
		}
		if(subject.value == ""){
			alert("信息主题不能为空！");
			return false;
		}
		if(content.value == ""){
			alert("信息内容不能为空！");
			return false;
		}
		return true;
	}

	function back(){
		var sign = "<c:out value='${sign}'/>";
		parent.window.location.href = "./internalMailbox.do?action=display&sign="+sign;
		window.location.target = "main";
	}
	
	function selectPersonDialog(){
		var url = "./internalMailbox.do?action=selectPerson";
		var dlgParam = "dialogHeight:400px;dialogWidth:500px;dialogTop:300px;dialogLeft:400px;status:no;help:no;scrollbars:yes;";
		var rt = window.showModalDialog(url,"",dlgParam);
		if(rt != undefined && rt != ""){			
			//根据从子窗口得到收件人ids和收件人names
			var userIds = "";
			var userNames = "";
			var tStr = rt.split("##");
			if(tStr[0] != "" && tStr[1] != ""){
				userIds = tStr[0];
				userNames = tStr[1];
			}
			document.getElementById("recipientsIds").value = userIds;
			document.getElementById("recipients").value = userNames;
		}
	}
	
	function save(){
		if(checkForm()){
			document.addInternalMailForm.action = "./internalMailbox.do?action=addInternalMail";
			document.addInternalMailForm.target = "main";
			document.addInternalMailForm.submit();
		}
	}
-->
</script>
</head>
<body>
<form name="addInternalMailForm" action="" method="post">
	<table class="table_title2">
		<tr>
			<td class="title_lab">
				发送纸条信息
			</td>
		</tr>
		<tr>
			<td align="center" valign="bottom">
				<button class="btn_submit" onclick="save()" hidefocus="true">发送</button>&nbsp;&nbsp;
				<button class="btn_back" onclick="back()" hidefocus="true">取消并返回</button>
			</td>
		</tr>
		<tr><td height="2"></td></tr>
		<tr>
			<td>
				<table class="table_add">
					<tr><td colspan="2" style="height: 5px;"></td></tr>
					<tr>
						<td class="title">收件人：</td>
						<td>
							<input id="recipients" name="recipients" class="input_msg" type="text" readonly="readonly"/>
							<input class="btn_select" type="button" value="" onclick="selectPersonDialog()"/>
							<input id="recipientsIds" name="recipientsIds" type="hidden"/>
							<input id="addresserId" name="addresserId" type="hidden" value="${userId}"/>
						</td>
					</tr>
					<tr>
						<td class="title">信息主题：</td>
						<td><input id="subject" name="subject" class="input_msg" type="text" maxlength="50"/></td>
					</tr>
					<tr>
						<td class="title">主题内容：</td>
						<td><textarea id="content" name="content" class="textarea_msg" wrap="hard"></textarea></td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
	<input id="sign" name="sign" type="hidden" value="${sign}"/>
</form>
</body>
</html>